package com.cheejee.goodscenter.module.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonFormat;

public class Goods {

	@NotNull(message = "商品id不能为空", groups = UpdateGroup.class)
	private Long id;

	@NotNull(message = "商品品牌不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	private Integer brandId;

	@NotNull(message = "商品分类不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	private Integer categoryId;

	@NotBlank(message = "商品名称不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	@Length(max = 200, message = "商品名称长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
	private String goodsName;

	private String subtitle;

	private String publicityPic;

	/**
	 * 商品的图片列表，多张图片使用逗号分隔
	 */
	@NotBlank(message = "商品图片不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	private String pics;

	@NotBlank(message = "商品单位不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	@Length(max = 30, message = "商品单位长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
	private String unit;

	@NotNull(message = "商品上架信息不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	private Boolean isOn;

	@NotNull(message = "商品删除状态不能为空", groups = { InsertGroup.class, UpdateGroup.class })
	private Boolean isDetelete;

	private Integer sale;

	private Date createTime;

	private Date updateTime;

	private String webDetail;

	private String mobileDetail;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getBrandId() {
		return brandId;
	}

	public void setBrandId(Integer brandId) {
		this.brandId = brandId;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName == null ? null : goodsName.trim();
	}

	public String getSubtitle() {
		return subtitle;
	}

	public void setSubtitle(String subtitle) {
		this.subtitle = subtitle == null ? null : subtitle.trim();
	}

	public String getPublicityPic() {
		return publicityPic;
	}

	public void setPublicityPic(String publicityPic) {
		this.publicityPic = publicityPic == null ? null : publicityPic.trim();
	}

	public String getPics() {
		return pics;
	}

	public void setPics(String pics) {
		this.pics = pics == null ? null : pics.trim();
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit == null ? null : unit.trim();
	}

	public Boolean getIsOn() {
		return isOn;
	}

	public void setIsOn(Boolean isOn) {
		this.isOn = isOn;
	}

	public Boolean getIsDetelete() {
		return isDetelete;
	}

	public void setIsDetelete(Boolean isDetelete) {
		this.isDetelete = isDetelete;
	}

	public Integer getSale() {
		return sale;
	}

	public void setSale(Integer sale) {
		this.sale = sale;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getWebDetail() {
		return webDetail;
	}

	public void setWebDetail(String webDetail) {
		this.webDetail = webDetail == null ? null : webDetail.trim();
	}

	public String getMobileDetail() {
		return mobileDetail;
	}

	public void setMobileDetail(String mobileDetail) {
		this.mobileDetail = mobileDetail == null ? null : mobileDetail.trim();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", brandId=").append(brandId);
		sb.append(", categoryId=").append(categoryId);
		sb.append(", goodsName=").append(goodsName);
		sb.append(", subtitle=").append(subtitle);
		sb.append(", publicityPic=").append(publicityPic);
		sb.append(", pics=").append(pics);
		sb.append(", unit=").append(unit);
		sb.append(", isOn=").append(isOn);
		sb.append(", isDetelete=").append(isDetelete);
		sb.append(", sale=").append(sale);
		sb.append(", createTime=").append(createTime);
		sb.append(", updateTime=").append(updateTime);
		sb.append(", webDetail=").append(webDetail);
		sb.append(", mobileDetail=").append(mobileDetail);
		sb.append("]");
		return sb.toString();
	}
}